import React,{Component} from 'react';
import {connect} from 'react-redux'
import CheckListItem from './checkListItem'
import SelectedItems from './selectedItems'

//const R = require('ramda');

class itemBox extends Component{
    constructor(props){
        super(props);
    }

    render() {
        const price = this.props.filter.price.map((val,index)=>{
            return <CheckListItem name={'price'} multiply={true} value={val} key={index} />
        });

         const bedroom = this.props.filter.bedroom.map((val,index)=>{
             return <CheckListItem name={'bedroom'} multiply={false} value={val} key={index} />
         });

        return (
            <div>
                <div>价格：
                    <div>{price}</div>
                </div>
                <div><br/>居室：
                    <div>{bedroom}</div>
                </div>
                <div><br/>已选：<SelectedItems/></div>
            </div>
        )
    }
}

const mapStateToProps = (state) => {
    return {
        filter: state.filter
    }
};

export default connect(mapStateToProps)(itemBox);